package com.google.jguery.client.common;

public class FieldText {

	String field;
	String text;
	
	public String getField() {
		return field;
	}

	public void setField(String fieldName) {
		this.field = fieldName;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	/**
	 * The Term is composed of filedName:text, indicating which field to 
	 * search for what content
	 */
	public FieldText(String fieldName, String text) {
		this.field = fieldName;
		this.text = text;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof FieldText) {
			FieldText ft2 = (FieldText) obj;
			return (this.field.equals(ft2.getField()) && 
					this.text.equals(ft2.getText()));
		}		
		return false;
	}

	@Override
	//this could cause clashing, but I feel it's ok
	public int hashCode() {
		return (field + ":" + text).hashCode();
	}

	@Override
	public String toString() {
		return field + ":" + text;
	}
}